package com.algorithm.string_and_array;

import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;

@Slf4j
public class SummarizeSolutionLC04 {


    public int findMin(int[] nums) {
        int j = 0;
        int index = 0;
        for (int i = 1; i < nums.length; i++) {
            if (nums[j] > nums[i]) {
                index = i;
                break;
            }
            j++;
        }
        return nums[index];
    }

    @Test
    public void test(){
        int [] nums = {5,4,3,2,1};
        int min = findMin(nums);
        log.info("this result is {}",min);
    }
}
